/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JInternalFrameSolution.java
 *
 * Created on Dec 11, 2011, 7:54:00 PM
 */
package bugreportingsystem;

import Util.BugReport;
import Util.CommonQuery;
import Util.Customer;
import Util.Solution;
import Util.Status;
import Util.TypeReport;
import java.awt.Color;
import java.awt.Font;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Jack
 */
public class JInternalFrameSolution extends javax.swing.JInternalFrame {

    /** Creates new form JInternalFrameSolution */
    int iddepartment = JFrameLogin.iddepartment;
    private Vector<Integer> idstatus = new Vector<Integer>();
    private Vector<String> displaystatus = new Vector<String>();
    private int r1 = -1;
    private int idbackend = JFrameLogin.idemployee;
    private int idreport = -1;
    private String language = JFrameLogin.language;
    private String country = JFrameLogin.country;
    private Locale lc = new Locale(language, country);
    private ResourceBundle rb = ResourceBundle.getBundle("bugreportingsystem/resources/JInternalFrameSolution", lc);

    public JInternalFrameSolution() {
        initComponents();
        AddYear();
        if (iddepartment == 1) {
            this.jLabelTiTle.setText(rb.getString("ManageSolution"));
            this.jTextAreaSolution.setEnabled(false);
            this.jButtonAdd.setVisible(false);
            this.jButtonDelete.setVisible(false);
            this.jButtonUpdate.setVisible(false);
            this.jComboBoxStatus.setEnabled(false);
            this.jButtonReset.setVisible(false);
            Display(BugReport.ListIDRP());
        }
        if (iddepartment == 2) {
            Display(BugReport.ListReportonType(1));
            this.jLabelTiTle.setText(rb.getString("CallSolution"));
        }
        if (iddepartment == 3) {
            Display(BugReport.ListReportonType(2));
            this.jLabelTiTle.setText(rb.getString("MailSolution"));
        }
        AddStatus();
        Date now = new Date();
        Calendar c2 = Calendar.getInstance();
        c2.setTime(now);
        String year = String.valueOf(c2.get(Calendar.YEAR));
        String day = String.valueOf(c2.get(Calendar.DATE));
        String month = String.valueOf(c2.get(Calendar.MONTH) + 1);

        this.jComboBoxYear.setSelectedItem(year);
        this.jComboBoxDay.setSelectedItem(day);
        this.jComboBoxMonth.setSelectedItem(month);
        MyTranslate(language, country);
    }

    private TitledBorder SetTitleBorder(String a) {
        Border etched = BorderFactory.createEtchedBorder();
        Font font = new Font("Tahoma", Font.BOLD, 14);
        TitledBorder Title = BorderFactory.createTitledBorder(etched, rb.getString(a));
        Title.setTitleJustification(TitledBorder.LEFT);
        Title.setTitleFont(font);
        Title.setTitleColor(Color.getColor("BLUE", 204));
        return Title;
    }

    private void MyTranslate(String language, String country) {
        jRadioButtonDateFinish.setText(rb.getString("jRadioButtonDateFinish.text"));
        jButtonSearchYear.setText(rb.getString("jButtonSearchYear.text"));
        jRadioButtonDispatch.setText(rb.getString("jRadioButtonDispatch.text"));
        jRadioButtonSolve.setText(rb.getString("jRadioButtonSolve.text"));
        jRadioButtonNotSolve.setText(rb.getString("jRadioButtonNotSolve.text"));
        jRadioButtonBoth.setText(rb.getString("jRadioButtonBoth.text"));
        jLabel11.setText(rb.getString("jLabel11.text"));
        jLabel6.setText(rb.getString("jLabel6.text"));
        jLabel12.setText(rb.getString("jLabel12.text"));
        jLabel13.setText(rb.getString("jLabel13.text"));
        jLabel14.setText(rb.getString("jLabel14.text"));
        jLabel15.setText(rb.getString("jLabel15.text"));
        jLabel7.setText(rb.getString("jLabel7.text"));
        jLabel8.setText(rb.getString("jLabel8.text"));
        jLabel9.setText(rb.getString("jLabel9.text"));
        jLabel10.setText(rb.getString("jLabel10.text"));
        jPanel15.setBorder(SetTitleBorder("jPanel15.border.title"));
        jPanel7.setBorder(SetTitleBorder("jPanel7.border.title"));
        jPanel16.setBorder(SetTitleBorder("jPanel16.border.title"));
        jButtonAdd.setText(rb.getString("jButtonAdd.text"));
        jButtonUpdate.setText(rb.getString("jButtonUpdate.text"));
        jButtonDelete.setText(rb.getString("jButtonDelete.text"));
        jButtonReset.setText(rb.getString("jButtonReset.text"));
        this.setTitle(rb.getString("Form.title"));

    }

    private void AddStatus() {
        Status st = new Status();
        Vector<Status> vrl = new Vector<Status>();
        vrl = st.ListStatus();

        for (Status i : vrl) {
            idstatus.add(i.getIdstatus());
            displaystatus.add(i.getNamestatus());
        }
        DefaultComboBoxModel dcb1 = new DefaultComboBoxModel(displaystatus);
        jComboBoxStatus.setModel(dcb1);
    }

    private void Display(Vector<BugReport> br) {
        Vector<String> cols = new Vector<String>();
        cols.add("idreport");
        cols.add("name customer");
        cols.add("iddispatch");
        cols.add("Date_Receive");
        cols.add("Date_Finish");
        cols.add("Status");
        cols.add("Type");
        BugReport ep = new BugReport();
        Vector<Vector<Object>> rows = new Vector<Vector<Object>>();
        for (int i = 0; i < br.size(); i++) {
            Vector<Object> i1 = new Vector<Object>();
            String nametype = TypeReport.ListType(br.get(i).getIdreport());
            String namestatus = Status.ListStatus(br.get(i).getIdreport());
            String namecustom = Customer.ListNameCustom(br.get(i).getIdreport());
            i1.add(br.get(i).getIdreport());
            i1.add(namecustom);
            i1.add(br.get(i).getIddispatch());
            i1.add(br.get(i).getDatereceive());
            i1.add(br.get(i).getDatefinish());
            i1.add(namestatus);
            i1.add(nametype);

            rows.add(i1);
        }
        DefaultTableModel dtm = new DefaultTableModel(rows, cols) {

            @Override
            public boolean isCellEditable(int row, int column) {
                return false;
            }
        };

        this.jTableReport.setModel(dtm);
        this.jTableReport.getTableHeader().setReorderingAllowed(false);
    }

    private void DisplayNull() {
        Vector<String> cols = new Vector<String>();
        cols.add("idreport");
        cols.add("name customer");
        cols.add("iddispatch");
        cols.add("Date_Receive");
        cols.add("Date_Finish");
        cols.add("Status");
        cols.add("Type");
        BugReport ep = new BugReport();
        Vector<Vector<Object>> rows = new Vector<Vector<Object>>();
        DefaultTableModel dtm = new DefaultTableModel(rows, cols) {

            @Override
            public boolean isCellEditable(int row, int column) {
                return false;
            }
        };
        this.jTableReport.setModel(dtm);
        this.jTableReport.getTableHeader().setReorderingAllowed(false);


    }

    private void AddYear() {
        try {
            Vector<String> year = new Vector<String>();
            for (int i = 2011; i < 2100; i++) {
                year.add(String.valueOf(i));
            }
            DefaultComboBoxModel dcb = new DefaultComboBoxModel(year);
            this.jComboBoxYear.setModel(dcb);


        } catch (Exception e) {
            System.out.println(e);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jLabelTiTle = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jPanel15 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jRadioButtonDateFinish = new javax.swing.JRadioButton();
        jPanel31 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jButtonSearchYear = new javax.swing.JButton();
        jPanel10 = new javax.swing.JPanel();
        jTextFieldSearch = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jPanel13 = new javax.swing.JPanel();
        jPanel29 = new javax.swing.JPanel();
        jComboBoxYear = new javax.swing.JComboBox();
        jPanel37 = new javax.swing.JPanel();
        jComboBoxDay = new javax.swing.JComboBox();
        jComboBoxMonth = new javax.swing.JComboBox();
        jPanel14 = new javax.swing.JPanel();
        jRadioButtonDispatch = new javax.swing.JRadioButton();
        jRadioButtonSolve = new javax.swing.JRadioButton();
        jRadioButtonNotSolve = new javax.swing.JRadioButton();
        jRadioButtonBoth = new javax.swing.JRadioButton();
        jPanel19 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTableReport = new javax.swing.JTable();
        jPanel16 = new javax.swing.JPanel();
        jPanel17 = new javax.swing.JPanel();
        jPanel26 = new javax.swing.JPanel();
        jPanel27 = new javax.swing.JPanel();
        jPanel28 = new javax.swing.JPanel();
        jButtonAdd = new javax.swing.JButton();
        jButtonUpdate = new javax.swing.JButton();
        jButtonDelete = new javax.swing.JButton();
        jButtonReset = new javax.swing.JButton();
        jPanel18 = new javax.swing.JPanel();
        jPanel30 = new javax.swing.JPanel();
        jPanel33 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        jPanel34 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextAreaSolution = new javax.swing.JTextArea();
        jPanel32 = new javax.swing.JPanel();
        jPanel35 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jPanel36 = new javax.swing.JPanel();
        jTextFieldTitle = new javax.swing.JTextField();
        jTextFieldNamefront = new javax.swing.JTextField();
        jTextFieldNameCustomer = new javax.swing.JTextField();
        jTextFieldNameBack = new javax.swing.JTextField();
        jPanel20 = new javax.swing.JPanel();
        jPanel22 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jPanel23 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextAreaContent = new javax.swing.JTextArea();
        jPanel21 = new javax.swing.JPanel();
        jPanel24 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jPanel25 = new javax.swing.JPanel();
        jTextFieldDateReceive = new javax.swing.JTextField();
        jTextFieldDateFinish = new javax.swing.JTextField();
        jTextFieldDateSolve = new javax.swing.JTextField();
        jComboBoxStatus = new javax.swing.JComboBox();

        setClosable(true);
        setIconifiable(true);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(bugreportingsystem.BugReportingSystemApp.class).getContext().getResourceMap(JInternalFrameSolution.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setFrameIcon(resourceMap.getIcon("Form.frameIcon")); // NOI18N
        setName("Form"); // NOI18N
        setPreferredSize(new java.awt.Dimension(1018, 607));

        jLabelTiTle.setFont(resourceMap.getFont("jLabelTiTle.font")); // NOI18N
        jLabelTiTle.setForeground(resourceMap.getColor("jLabelTiTle.foreground")); // NOI18N
        jLabelTiTle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTiTle.setText(resourceMap.getString("jLabelTiTle.text")); // NOI18N
        jLabelTiTle.setName("jLabelTiTle"); // NOI18N
        jLabelTiTle.setPreferredSize(new java.awt.Dimension(0, 30));
        getContentPane().add(jLabelTiTle, java.awt.BorderLayout.PAGE_START);

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N
        jLabel2.setPreferredSize(new java.awt.Dimension(100, 0));
        getContentPane().add(jLabel2, java.awt.BorderLayout.LINE_END);

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N
        jLabel3.setPreferredSize(new java.awt.Dimension(100, 0));
        getContentPane().add(jLabel3, java.awt.BorderLayout.LINE_START);

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N
        getContentPane().add(jLabel4, java.awt.BorderLayout.PAGE_END);

        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setLayout(new java.awt.BorderLayout());

        jPanel2.setName("jPanel2"); // NOI18N
        jPanel2.setPreferredSize(new java.awt.Dimension(676, 90));
        jPanel2.setLayout(new java.awt.BorderLayout());

        jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), resourceMap.getString("jPanel15.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("jPanel15.border.titleFont"), resourceMap.getColor("jPanel15.border.titleColor"))); // NOI18N
        jPanel15.setName("jPanel15"); // NOI18N
        jPanel15.setPreferredSize(new java.awt.Dimension(628, 270));
        jPanel15.setLayout(new java.awt.GridLayout(2, 1, 10, 10));

        jPanel4.setName("jPanel4"); // NOI18N
        jPanel4.setLayout(new java.awt.BorderLayout(35, 0));

        jPanel6.setName("jPanel6"); // NOI18N
        jPanel6.setPreferredSize(new java.awt.Dimension(250, 85));
        jPanel6.setLayout(new java.awt.BorderLayout());

        jRadioButtonDateFinish.setText(resourceMap.getString("jRadioButtonDateFinish.text")); // NOI18N
        jRadioButtonDateFinish.setName("jRadioButtonDateFinish"); // NOI18N
        jRadioButtonDateFinish.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonDateFinishActionPerformed(evt);
            }
        });
        jPanel6.add(jRadioButtonDateFinish, java.awt.BorderLayout.CENTER);

        jPanel31.setName("jPanel31"); // NOI18N
        jPanel31.setPreferredSize(new java.awt.Dimension(120, 30));
        jPanel31.setLayout(new java.awt.BorderLayout());
        jPanel6.add(jPanel31, java.awt.BorderLayout.LINE_END);

        jPanel4.add(jPanel6, java.awt.BorderLayout.LINE_START);

        jPanel8.setName("jPanel8"); // NOI18N
        jPanel8.setLayout(new java.awt.BorderLayout(20, 0));

        jPanel9.setName("jPanel9"); // NOI18N
        jPanel9.setPreferredSize(new java.awt.Dimension(115, 35));
        jPanel9.setLayout(new java.awt.BorderLayout());

        jButtonSearchYear.setIcon(resourceMap.getIcon("jButtonSearchYear.icon")); // NOI18N
        jButtonSearchYear.setText(resourceMap.getString("jButtonSearchYear.text")); // NOI18N
        jButtonSearchYear.setName("jButtonSearchYear"); // NOI18N
        jButtonSearchYear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSearchYearActionPerformed(evt);
            }
        });
        jPanel9.add(jButtonSearchYear, java.awt.BorderLayout.CENTER);

        jPanel8.add(jPanel9, java.awt.BorderLayout.LINE_END);

        jPanel10.setName("jPanel10"); // NOI18N
        jPanel10.setLayout(new java.awt.BorderLayout(15, 0));

        jTextFieldSearch.setText(resourceMap.getString("jTextFieldSearch.text")); // NOI18N
        jTextFieldSearch.setName("jTextFieldSearch"); // NOI18N
        jPanel10.add(jTextFieldSearch, java.awt.BorderLayout.CENTER);

        jPanel8.add(jPanel10, java.awt.BorderLayout.CENTER);

        jPanel4.add(jPanel8, java.awt.BorderLayout.CENTER);

        jPanel15.add(jPanel4);

        jPanel5.setName("jPanel5"); // NOI18N
        jPanel5.setLayout(new java.awt.BorderLayout(30, 0));

        jPanel13.setName("jPanel13"); // NOI18N
        jPanel13.setPreferredSize(new java.awt.Dimension(250, 35));
        jPanel13.setLayout(new java.awt.BorderLayout(10, 0));

        jPanel29.setName("jPanel29"); // NOI18N
        jPanel29.setPreferredSize(new java.awt.Dimension(80, 47));
        jPanel29.setLayout(new java.awt.BorderLayout());

        jComboBoxYear.setName("jComboBoxYear"); // NOI18N
        jComboBoxYear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxYearActionPerformed(evt);
            }
        });
        jPanel29.add(jComboBoxYear, java.awt.BorderLayout.CENTER);

        jPanel13.add(jPanel29, java.awt.BorderLayout.LINE_END);

        jPanel37.setName("jPanel37"); // NOI18N
        jPanel37.setLayout(new java.awt.GridLayout(1, 2, 10, 0));

        jComboBoxDay.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        jComboBoxDay.setName("jComboBoxDay"); // NOI18N
        jPanel37.add(jComboBoxDay);

        jComboBoxMonth.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }));
        jComboBoxMonth.setName("jComboBoxMonth"); // NOI18N
        jPanel37.add(jComboBoxMonth);

        jPanel13.add(jPanel37, java.awt.BorderLayout.CENTER);

        jPanel5.add(jPanel13, java.awt.BorderLayout.LINE_START);

        jPanel14.setName("jPanel14"); // NOI18N
        jPanel14.setLayout(new java.awt.GridLayout(1, 4, 5, 0));

        buttonGroup1.add(jRadioButtonDispatch);
        jRadioButtonDispatch.setText(resourceMap.getString("jRadioButtonDispatch.text")); // NOI18N
        jRadioButtonDispatch.setName("jRadioButtonDispatch"); // NOI18N
        jRadioButtonDispatch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonDispatchActionPerformed(evt);
            }
        });
        jPanel14.add(jRadioButtonDispatch);

        buttonGroup1.add(jRadioButtonSolve);
        jRadioButtonSolve.setText(resourceMap.getString("jRadioButtonSolve.text")); // NOI18N
        jRadioButtonSolve.setName("jRadioButtonSolve"); // NOI18N
        jRadioButtonSolve.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonSolveActionPerformed(evt);
            }
        });
        jPanel14.add(jRadioButtonSolve);

        buttonGroup1.add(jRadioButtonNotSolve);
        jRadioButtonNotSolve.setText(resourceMap.getString("jRadioButtonNotSolve.text")); // NOI18N
        jRadioButtonNotSolve.setName("jRadioButtonNotSolve"); // NOI18N
        jRadioButtonNotSolve.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonNotSolveActionPerformed(evt);
            }
        });
        jPanel14.add(jRadioButtonNotSolve);

        buttonGroup1.add(jRadioButtonBoth);
        jRadioButtonBoth.setText(resourceMap.getString("jRadioButtonBoth.text")); // NOI18N
        jRadioButtonBoth.setName("jRadioButtonBoth"); // NOI18N
        jRadioButtonBoth.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonBothActionPerformed(evt);
            }
        });
        jPanel14.add(jRadioButtonBoth);

        jPanel5.add(jPanel14, java.awt.BorderLayout.CENTER);

        jPanel15.add(jPanel5);

        jPanel2.add(jPanel15, java.awt.BorderLayout.CENTER);

        jPanel19.setName("jPanel19"); // NOI18N
        jPanel19.setPreferredSize(new java.awt.Dimension(1, 90));

        javax.swing.GroupLayout jPanel19Layout = new javax.swing.GroupLayout(jPanel19);
        jPanel19.setLayout(jPanel19Layout);
        jPanel19Layout.setHorizontalGroup(
            jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1, Short.MAX_VALUE)
        );
        jPanel19Layout.setVerticalGroup(
            jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 90, Short.MAX_VALUE)
        );

        jPanel2.add(jPanel19, java.awt.BorderLayout.LINE_END);

        jPanel1.add(jPanel2, java.awt.BorderLayout.PAGE_START);

        jPanel3.setName("jPanel3"); // NOI18N
        jPanel3.setPreferredSize(new java.awt.Dimension(854, 360));
        jPanel3.setLayout(new java.awt.BorderLayout());

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), resourceMap.getString("jPanel7.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("jPanel7.border.titleFont"), resourceMap.getColor("jPanel7.border.titleColor"))); // NOI18N
        jPanel7.setName("jPanel7"); // NOI18N
        jPanel7.setPreferredSize(new java.awt.Dimension(854, 160));
        jPanel7.setLayout(new java.awt.BorderLayout());

        jScrollPane1.setName("jScrollPane1"); // NOI18N
        jScrollPane1.setPreferredSize(new java.awt.Dimension(600, 200));

        jTableReport.setAutoscrolls(false);
        jTableReport.setName("jTableReport"); // NOI18N
        jTableReport.setPreferredSize(new java.awt.Dimension(600, 230));
        jTableReport.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jTableReport.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTableReportMouseClicked(evt);
            }
        });
        jTableReport.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTableReportKeyReleased(evt);
            }
        });
        jScrollPane1.setViewportView(jTableReport);

        jPanel7.add(jScrollPane1, java.awt.BorderLayout.CENTER);

        jPanel3.add(jPanel7, java.awt.BorderLayout.PAGE_START);

        jPanel16.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), resourceMap.getString("jPanel16.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("jPanel16.border.titleFont"), resourceMap.getColor("jPanel16.border.titleColor"))); // NOI18N
        jPanel16.setName("jPanel16"); // NOI18N
        jPanel16.setLayout(new java.awt.BorderLayout(0, 5));

        jPanel17.setName("jPanel17"); // NOI18N
        jPanel17.setPreferredSize(new java.awt.Dimension(842, 25));
        jPanel17.setLayout(new java.awt.BorderLayout());

        jPanel26.setName("jPanel26"); // NOI18N
        jPanel26.setPreferredSize(new java.awt.Dimension(97, 3));

        javax.swing.GroupLayout jPanel26Layout = new javax.swing.GroupLayout(jPanel26);
        jPanel26.setLayout(jPanel26Layout);
        jPanel26Layout.setHorizontalGroup(
            jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 97, Short.MAX_VALUE)
        );
        jPanel26Layout.setVerticalGroup(
            jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 25, Short.MAX_VALUE)
        );

        jPanel17.add(jPanel26, java.awt.BorderLayout.LINE_START);

        jPanel27.setName("jPanel27"); // NOI18N
        jPanel27.setPreferredSize(new java.awt.Dimension(220, 30));

        javax.swing.GroupLayout jPanel27Layout = new javax.swing.GroupLayout(jPanel27);
        jPanel27.setLayout(jPanel27Layout);
        jPanel27Layout.setHorizontalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 220, Short.MAX_VALUE)
        );
        jPanel27Layout.setVerticalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 25, Short.MAX_VALUE)
        );

        jPanel17.add(jPanel27, java.awt.BorderLayout.LINE_END);

        jPanel28.setName("jPanel28"); // NOI18N
        jPanel28.setLayout(new java.awt.GridLayout(1, 4, 10, 0));

        jButtonAdd.setIcon(resourceMap.getIcon("jButtonAdd.icon")); // NOI18N
        jButtonAdd.setText(resourceMap.getString("jButtonAdd.text")); // NOI18N
        jButtonAdd.setName("jButtonAdd"); // NOI18N
        jButtonAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAddActionPerformed(evt);
            }
        });
        jPanel28.add(jButtonAdd);

        jButtonUpdate.setIcon(resourceMap.getIcon("jButtonUpdate.icon")); // NOI18N
        jButtonUpdate.setText(resourceMap.getString("jButtonUpdate.text")); // NOI18N
        jButtonUpdate.setName("jButtonUpdate"); // NOI18N
        jButtonUpdate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonUpdateActionPerformed(evt);
            }
        });
        jPanel28.add(jButtonUpdate);

        jButtonDelete.setIcon(resourceMap.getIcon("jButtonDelete.icon")); // NOI18N
        jButtonDelete.setText(resourceMap.getString("jButtonDelete.text")); // NOI18N
        jButtonDelete.setName("jButtonDelete"); // NOI18N
        jButtonDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonDeleteActionPerformed(evt);
            }
        });
        jPanel28.add(jButtonDelete);

        jButtonReset.setIcon(resourceMap.getIcon("jButtonReset.icon")); // NOI18N
        jButtonReset.setText(resourceMap.getString("jButtonReset.text")); // NOI18N
        jButtonReset.setName("jButtonReset"); // NOI18N
        jButtonReset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonResetActionPerformed(evt);
            }
        });
        jPanel28.add(jButtonReset);

        jPanel17.add(jPanel28, java.awt.BorderLayout.CENTER);

        jPanel16.add(jPanel17, java.awt.BorderLayout.PAGE_END);

        jPanel18.setName("jPanel18"); // NOI18N
        jPanel18.setLayout(new java.awt.GridLayout(2, 2, 30, 5));

        jPanel30.setName("jPanel30"); // NOI18N
        jPanel30.setLayout(new java.awt.BorderLayout(20, 0));

        jPanel33.setName("jPanel33"); // NOI18N
        jPanel33.setPreferredSize(new java.awt.Dimension(80, 64));
        jPanel33.setLayout(new java.awt.GridLayout(3, 0));

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N
        jPanel33.add(jLabel11);

        jPanel30.add(jPanel33, java.awt.BorderLayout.LINE_START);

        jPanel34.setName("jPanel34"); // NOI18N
        jPanel34.setLayout(new java.awt.BorderLayout());

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        jTextAreaSolution.setColumns(20);
        jTextAreaSolution.setRows(5);
        jTextAreaSolution.setName("jTextAreaSolution"); // NOI18N
        jScrollPane3.setViewportView(jTextAreaSolution);

        jPanel34.add(jScrollPane3, java.awt.BorderLayout.CENTER);

        jPanel30.add(jPanel34, java.awt.BorderLayout.CENTER);

        jPanel18.add(jPanel30);

        jPanel32.setName("jPanel32"); // NOI18N
        jPanel32.setLayout(new java.awt.BorderLayout(15, 0));

        jPanel35.setName("jPanel35"); // NOI18N
        jPanel35.setPreferredSize(new java.awt.Dimension(120, 79));
        jPanel35.setLayout(new java.awt.GridLayout(4, 1, 0, 5));

        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N
        jPanel35.add(jLabel12);

        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N
        jPanel35.add(jLabel13);

        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N
        jPanel35.add(jLabel14);

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N
        jPanel35.add(jLabel15);

        jPanel32.add(jPanel35, java.awt.BorderLayout.LINE_START);

        jPanel36.setName("jPanel36"); // NOI18N
        jPanel36.setLayout(new java.awt.GridLayout(4, 1, 0, 5));

        jTextFieldTitle.setEditable(false);
        jTextFieldTitle.setName("jTextFieldTitle"); // NOI18N
        jPanel36.add(jTextFieldTitle);

        jTextFieldNamefront.setEditable(false);
        jTextFieldNamefront.setName("jTextFieldNamefront"); // NOI18N
        jPanel36.add(jTextFieldNamefront);

        jTextFieldNameCustomer.setEditable(false);
        jTextFieldNameCustomer.setName("jTextFieldNameCustomer"); // NOI18N
        jTextFieldNameCustomer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldNameCustomerActionPerformed(evt);
            }
        });
        jPanel36.add(jTextFieldNameCustomer);

        jTextFieldNameBack.setEditable(false);
        jTextFieldNameBack.setName("jTextFieldNameBack"); // NOI18N
        jPanel36.add(jTextFieldNameBack);

        jPanel32.add(jPanel36, java.awt.BorderLayout.CENTER);

        jPanel18.add(jPanel32);

        jPanel20.setName("jPanel20"); // NOI18N
        jPanel20.setLayout(new java.awt.BorderLayout(20, 0));

        jPanel22.setName("jPanel22"); // NOI18N
        jPanel22.setPreferredSize(new java.awt.Dimension(80, 64));
        jPanel22.setLayout(new java.awt.GridLayout(4, 1));

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N
        jPanel22.add(jLabel6);

        jPanel20.add(jPanel22, java.awt.BorderLayout.LINE_START);

        jPanel23.setName("jPanel23"); // NOI18N
        jPanel23.setLayout(new java.awt.BorderLayout());

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jTextAreaContent.setColumns(20);
        jTextAreaContent.setEditable(false);
        jTextAreaContent.setRows(5);
        jTextAreaContent.setName("jTextAreaContent"); // NOI18N
        jScrollPane2.setViewportView(jTextAreaContent);

        jPanel23.add(jScrollPane2, java.awt.BorderLayout.CENTER);

        jPanel20.add(jPanel23, java.awt.BorderLayout.CENTER);

        jPanel18.add(jPanel20);

        jPanel21.setName("jPanel21"); // NOI18N
        jPanel21.setLayout(new java.awt.BorderLayout(15, 0));

        jPanel24.setMinimumSize(new java.awt.Dimension(90, 79));
        jPanel24.setName("jPanel24"); // NOI18N
        jPanel24.setPreferredSize(new java.awt.Dimension(120, 79));
        jPanel24.setLayout(new java.awt.GridLayout(4, 1, 0, 5));

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N
        jPanel24.add(jLabel7);

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N
        jPanel24.add(jLabel8);

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N
        jPanel24.add(jLabel9);

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N
        jPanel24.add(jLabel10);

        jPanel21.add(jPanel24, java.awt.BorderLayout.LINE_START);

        jPanel25.setName("jPanel25"); // NOI18N
        jPanel25.setLayout(new java.awt.GridLayout(4, 1, 0, 5));

        jTextFieldDateReceive.setEditable(false);
        jTextFieldDateReceive.setName("jTextFieldDateReceive"); // NOI18N
        jPanel25.add(jTextFieldDateReceive);

        jTextFieldDateFinish.setEditable(false);
        jTextFieldDateFinish.setName("jTextFieldDateFinish"); // NOI18N
        jPanel25.add(jTextFieldDateFinish);

        jTextFieldDateSolve.setEditable(false);
        jTextFieldDateSolve.setName("jTextFieldDateSolve"); // NOI18N
        jPanel25.add(jTextFieldDateSolve);

        jComboBoxStatus.setName("jComboBoxStatus"); // NOI18N
        jPanel25.add(jComboBoxStatus);

        jPanel21.add(jPanel25, java.awt.BorderLayout.CENTER);

        jPanel18.add(jPanel21);

        jPanel16.add(jPanel18, java.awt.BorderLayout.CENTER);

        jPanel3.add(jPanel16, java.awt.BorderLayout.CENTER);

        jPanel1.add(jPanel3, java.awt.BorderLayout.CENTER);

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonSearchYearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSearchYearActionPerformed
        // TODO add your handling code here:



        if (jRadioButtonBoth.isSelected() == false && jRadioButtonDateFinish.isSelected() == false && jRadioButtonDispatch.isSelected() == false && jRadioButtonNotSolve.isSelected() == false && jRadioButtonSolve.isSelected() == false) {
            JOptionPane.showMessageDialog(null, rb.getString("ChooseButton"));
        } else {
            if (iddepartment == 2) {
                if (jRadioButtonBoth.isSelected() == true) {
                    if (BugReport.ListReportonType(1).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindAnyValue"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonType(1));
                        jTableReport.getComponent(0);
                    }
                }
                if (jRadioButtonNotSolve.isSelected() == true) {
                    if (BugReport.ListReportonType_Status(1, 1).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindAnyValue"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonType_Status(1, 1));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonSolve.isSelected() == true) {
                    if (BugReport.ListReportonType_Status(2, 1).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindAnyValue"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonType_Status(2, 1));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonDateFinish.isSelected()) {
                    if (BugReport.ListReportonTypeAndDate(convertdate(), 1).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDate"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonTypeAndDate(convertdate(), 1));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }

                if (jRadioButtonDateFinish.isSelected() == true && jRadioButtonBoth.isSelected() == true) {
                    if (BugReport.ListReportonTypeAndDate(convertdate(), 1).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDate"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonTypeAndDate(convertdate(), 1));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonDateFinish.isSelected() == true && jRadioButtonNotSolve.isSelected() == true) {
                    if (BugReport.ListReportonTypeAndDateAndStatus(1, convertdate(), 1).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDate"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonTypeAndDateAndStatus(1, convertdate(), 1));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonDateFinish.isSelected() == true && jRadioButtonSolve.isSelected() == true) {
                    if (BugReport.ListReportonTypeAndDateAndStatus(2, convertdate(), 1).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDate"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonTypeAndDateAndStatus(2, convertdate(), 1));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
            }
            if (iddepartment == 3) {
                if (jRadioButtonBoth.isSelected() == true) {
                    if (BugReport.ListReportonType(2).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindAnyValue"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonType(2));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonNotSolve.isSelected() == true) {
                    if (BugReport.ListReportonType_Status(1, 2).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindAnyValue"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonType_Status(1, 2));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonSolve.isSelected() == true) {
                    if (BugReport.ListReportonType_Status(2, 2).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindAnyValue"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonType_Status(2, 2));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonDateFinish.isSelected()) {
                    if (BugReport.ListReportonTypeAndDate(convertdate(), 2).size() == -0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDate"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonTypeAndDate(convertdate(), 2));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonDateFinish.isSelected() == true && jRadioButtonBoth.isSelected() == true) {
                    if (BugReport.ListReportonTypeAndDate(convertdate(), 2).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDate"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonTypeAndDate(convertdate(), 2));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonDateFinish.isSelected() == true && jRadioButtonNotSolve.isSelected() == true) {
                    if (BugReport.ListReportonTypeAndDateAndStatus(1, convertdate(), 2).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDate"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonTypeAndDateAndStatus(1, convertdate(), 2));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonDateFinish.isSelected() == true && jRadioButtonSolve.isSelected() == true) {
                    if (BugReport.ListReportonTypeAndDateAndStatus(2, convertdate(), 2).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDate"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportonTypeAndDateAndStatus(2, convertdate(), 2));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
            }
            if (iddepartment == 1) {
                if (jRadioButtonBoth.isSelected() == true) {
                    if (BugReport.ListIDRP().size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindAnyValue"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListIDRP());
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonNotSolve.isSelected() == true) {
                    if (BugReport.ListIDRPONSTATUS(1).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindAnyValue"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListIDRPONSTATUS(1));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonSolve.isSelected() == true) {
                    if (BugReport.ListIDRPONSTATUS(2).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindAnyValue"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListIDRPONSTATUS(2));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonDateFinish.isSelected()) {
                    if (BugReport.ListReportOnDate(convertdate()).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDate"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportOnDate(convertdate()));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonDateFinish.isSelected() == true && jRadioButtonBoth.isSelected() == true) {
                    if (BugReport.ListReportOnDate(convertdate()).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDate"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportOnDate(convertdate()));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonDateFinish.isSelected() == true && jRadioButtonNotSolve.isSelected() == true) {
                    if (BugReport.ListReportOnDateandStatus(convertdate(), 1).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDate"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportOnDateandStatus(convertdate(), 1));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
                if (jRadioButtonDateFinish.isSelected() == true && jRadioButtonSolve.isSelected() == true) {
                    if (BugReport.ListReportOnDateandStatus(convertdate(), 2).size() == 0) {
                        JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDate"));
                        DisplayNull();
                        return;
                    } else {
                        Display(BugReport.ListReportOnDateandStatus(convertdate(), 2));
                        jTableReport.setRowSelectionInterval(0, 0);
                    }
                }
            }
            if (jRadioButtonDispatch.isSelected() == true) {

                if (jTextFieldSearch.getText().trim().toString().length() == 0) {
                    JOptionPane.showMessageDialog(null, rb.getString("InputNumber"));
                } else if (jTextFieldSearch.getText().trim().toString().length() != 0) {
                    if (CommonQuery.CheckIntNumber(jTextFieldSearch.getText()) == false) {
                        JOptionPane.showMessageDialog(null, rb.getString("CheckNumber"));
                    } else if (iddepartment == 2) {
                        if (BugReport.ListIDRPONIPDISPATCHANDTYPE(Integer.parseInt(jTextFieldSearch.getText()), 1).size() == 0) {
                            JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDispatch"));
                            DisplayNull();
                            return;
                        } else {
                            Display(BugReport.ListIDRPONIPDISPATCHANDTYPE(Integer.parseInt(jTextFieldSearch.getText()), 1));
                            jTableReport.setRowSelectionInterval(0, 0);
                        }
                    } else if (iddepartment == 3) {
                        if (BugReport.ListIDRPONIPDISPATCHANDTYPE(Integer.parseInt(jTextFieldSearch.getText()), 2).size() == 0) {
                            JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDispatch"));
                            DisplayNull();
                            return;
                        } else {
                            Display(BugReport.ListIDRPONIPDISPATCHANDTYPE(Integer.parseInt(jTextFieldSearch.getText()), 2));
                            jTableReport.setRowSelectionInterval(0, 0);
                        }
                    } else if (iddepartment == 1) {
                        if (BugReport.ListIDRPONIPDISPATCH(Integer.parseInt(jTextFieldSearch.getText())).size() == 0) {
                            JOptionPane.showMessageDialog(null, rb.getString("CantFindValueDispatch"));
                            DisplayNull();
                            return;
                        } else {
                            Display(BugReport.ListIDRPONIPDISPATCH(Integer.parseInt(jTextFieldSearch.getText())));
                            jTableReport.setAutoscrolls(true);
                        }
                    }
                }
            }


        }
}//GEN-LAST:event_jButtonSearchYearActionPerformed

    private void jTableReportMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableReportMouseClicked
        // TODO add your handling code here:
        try {
            r1 = jTableReport.getSelectedRow();
            idreport = Integer.parseInt(jTableReport.getValueAt(r1, 0).toString());
            String namestatus = Status.ListStatus(idreport);
            String namefront = BugReport.ListNameFontEnd(idreport);
            String namecustom = Customer.ListNameCustom(idreport);
            String nameback = Solution.ListNameBackEnd(idreport);
            String title = BugReport.ListReportONIDReport(idreport).get(0).getTitle();
            String content = BugReport.ListReportONIDReport(idreport).get(0).getContent();
            String solution = Solution.ListIDSL(idreport).getSolution();
            String datefinish = BugReport.ListReportONIDReport(idreport).get(0).getDatefinish().toString();
            String datereceive = BugReport.ListReportONIDReport(idreport).get(0).getDatereceive().toString();
            String datesolve = "";
            if (String.valueOf(Solution.ListIDSL(idreport).getDate_solve()).length() - 4 != 0) {

                datesolve = String.valueOf(Solution.ListIDSL(idreport).getDate_solve().toString());
            }
            jTextFieldDateFinish.setText(datefinish);
            jTextFieldDateReceive.setText(datereceive);
            jTextFieldDateSolve.setText(datesolve);
            jTextFieldNamefront.setText(namefront);
            jTextFieldNameBack.setText(nameback);
            jTextAreaContent.setText(content);
            jTextFieldTitle.setText(title);
            jTextFieldNameCustomer.setText(namecustom);

            jTextAreaSolution.setText(solution);
            jComboBoxStatus.setSelectedItem(namestatus);
        } catch (Exception ex) {
        }
}//GEN-LAST:event_jTableReportMouseClicked

    private void jTextFieldNameCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldNameCustomerActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldNameCustomerActionPerformed

    private void jButtonAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddActionPerformed
        // TODO add your handling code here:
        if (idreport < 0) {
            JOptionPane.showMessageDialog(null, rb.getString("ChooseReport"));
        } else {
            Solution sl = new Solution();
            BugReport br = new BugReport();
            if (jTextAreaSolution.getText().toString().trim().length() == 0) {
                JOptionPane.showMessageDialog(null, rb.getString("InputSolution"));
            } else {
                int index = jComboBoxStatus.getSelectedIndex();

                int idstatus1 = idstatus.get(index);
                String solution = jTextAreaSolution.getText();
                Date now = new Date();
                java.sql.Date now1 = new java.sql.Date(now.getTime());
                sl.setSolution(solution);
                sl.setIdbackend(idbackend);
                sl.setDate_solve(now1);
                sl.setIdreport(idreport);
                br.setIDStatus(idstatus1);
                br.setIdreport(idreport);
                if (sl.addsolution() == true && br.updatestatus() == true) {
                    JOptionPane.showMessageDialog(null, rb.getString("AddSuccess"));

                    jTextFieldTitle.setText("");
                    jTextFieldNamefront.setText("");
                    jTextFieldNameCustomer.setText("");
                    jTextFieldNameBack.setText("");
                    jTextFieldDateReceive.setText("");
                    jTextFieldDateFinish.setText("");
                    jTextFieldDateSolve.setText("");
                    jTextAreaSolution.setText("");
                    jTextAreaContent.setText("");


                    if (iddepartment == 1) {

                        Display(BugReport.ListReportONIDReport(idreport));
                    }
                    if (iddepartment == 2) {
                        Display(BugReport.ListReportONIDReport(idreport));

                    }
                    if (iddepartment == 3) {
                        Display(BugReport.ListReportONIDReport(idreport));

                    }
                    idreport = -1;
                } else {
                    JOptionPane.showMessageDialog(null, rb.getString("HasSolution"));
                }
            }
        }
    }//GEN-LAST:event_jButtonAddActionPerformed

    private void jButtonUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonUpdateActionPerformed
        // TODO add your handling code here:
        if (idreport < 0) {
            JOptionPane.showMessageDialog(null, rb.getString("ChooseReport"));
        } else {
            Solution sl = new Solution();
            BugReport br = new BugReport();
            if (jTextAreaSolution.getText().toString().trim().length() == 0) {
                JOptionPane.showMessageDialog(null, rb.getString("InputSolution"));
            } else {
                int index = jComboBoxStatus.getSelectedIndex();

                int idstatus1 = idstatus.get(index);
                String solution = jTextAreaSolution.getText();
                Date now = new Date();
                java.sql.Date now1 = new java.sql.Date(now.getTime());
                sl.setSolution(solution);
                sl.setIdbackend(idbackend);
                sl.setDate_solve(now1);
                sl.setIdreport(idreport);
                br.setIDStatus(idstatus1);
                br.setIdreport(idreport);
                if (sl.updatesolution() == true && br.updatestatus() == true) {
                    JOptionPane.showMessageDialog(null, rb.getString("UpdateSuccess"));

                    jTextFieldTitle.setText("");
                    jTextFieldNamefront.setText("");
                    jTextFieldNameCustomer.setText("");
                    jTextFieldNameBack.setText("");
                    jTextFieldDateReceive.setText("");
                    jTextFieldDateFinish.setText("");
                    jTextFieldDateSolve.setText("");
                    jTextAreaSolution.setText("");
                    jTextAreaContent.setText("");

                    if (iddepartment == 1) {

                        Display(BugReport.ListReportONIDReport(idreport));
                    } else if (iddepartment == 2) {
                        Display(BugReport.ListReportONIDReport(idreport));

                    } else if (iddepartment == 3) {
                        Display(BugReport.ListReportONIDReport(idreport));

                    }
                    idreport = -1;
                } else {
                    JOptionPane.showMessageDialog(null, rb.getString("DidntAdd"));
                }
            }
        }
    }//GEN-LAST:event_jButtonUpdateActionPerformed

    private void jButtonDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDeleteActionPerformed
        // TODO add your handling code here:
        if (idreport < 0) {
            JOptionPane.showMessageDialog(null, rb.getString("ChooseReport"));
        } else {
            Solution sl = new Solution();

            sl.setIdreport(idreport);

            if (sl.deletesolution() == true) {
                JOptionPane.showMessageDialog(null, rb.getString("DeleteSuccess"));

                jTextFieldTitle.setText("");
                jTextFieldNamefront.setText("");
                jTextFieldNameCustomer.setText("");
                jTextFieldNameBack.setText("");
                jTextFieldDateReceive.setText("");
                jTextFieldDateFinish.setText("");
                jTextFieldDateSolve.setText("");
                jTextAreaSolution.setText("");
                jTextAreaContent.setText("");

                if (iddepartment == 1) {

                    Display(BugReport.ListIDRP());
                }
                if (iddepartment == 2) {
                    Display(BugReport.ListReportonType(1));

                }
                if (iddepartment == 3) {
                    Display(BugReport.ListReportonType(2));

                }
                idreport = -1;
            } else {
                JOptionPane.showMessageDialog(null, rb.getString("DidntAddSolution"));
            }
        }
    }//GEN-LAST:event_jButtonDeleteActionPerformed

    private void jRadioButtonDispatchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonDispatchActionPerformed
        // TODO add your handling code here:

        if (jRadioButtonDispatch.isSelected() == true) {
            jTextFieldSearch.setEnabled(true);
            jRadioButtonDateFinish.setEnabled(false);
        }

    }//GEN-LAST:event_jRadioButtonDispatchActionPerformed

    private void jRadioButtonSolveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonSolveActionPerformed
        // TODO add your handling code here:

        if (jRadioButtonSolve.isSelected() == true) {
            jTextFieldSearch.setEnabled(false);
            jRadioButtonDateFinish.setEnabled(true);
        }
    }//GEN-LAST:event_jRadioButtonSolveActionPerformed

    private void jRadioButtonNotSolveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonNotSolveActionPerformed
        // TODO add your handling code here:
        if (jRadioButtonNotSolve.isSelected() == true) {
            jTextFieldSearch.setEnabled(false);
            jRadioButtonDateFinish.setEnabled(true);
        }
    }//GEN-LAST:event_jRadioButtonNotSolveActionPerformed

    private void jRadioButtonBothActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonBothActionPerformed
        // TODO add your handling code here:
        if (jRadioButtonBoth.isSelected() == true) {
            jTextFieldSearch.setEnabled(false);
            jRadioButtonDateFinish.setEnabled(true);
        }
    }//GEN-LAST:event_jRadioButtonBothActionPerformed

    private void jTableReportKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTableReportKeyReleased
        // TODO add your handling code here:
        try {
            r1 = jTableReport.getSelectedRow();
            idreport = Integer.parseInt(jTableReport.getValueAt(r1, 0).toString());
            String namestatus = Status.ListStatus(idreport);
            String namefront = BugReport.ListNameFontEnd(idreport);
            String namecustom = Customer.ListNameCustom(idreport);
            String nameback = Solution.ListNameBackEnd(idreport);
            String title = BugReport.ListReportONIDReport(idreport).get(0).getTitle();
            String content = BugReport.ListReportONIDReport(idreport).get(0).getContent();
            String solution = Solution.ListIDSL(idreport).getSolution();
            String datefinish = BugReport.ListReportONIDReport(idreport).get(0).getDatefinish().toString();
            String datereceive = BugReport.ListReportONIDReport(idreport).get(0).getDatereceive().toString();
            String datesolve = "";
            if (String.valueOf(Solution.ListIDSL(idreport).getDate_solve()).length() - 4 != 0) {
                datesolve = String.valueOf(Solution.ListIDSL(idreport).getDate_solve().toString());
            }
            jTextFieldDateFinish.setText(datefinish);
            jTextFieldDateReceive.setText(datereceive);
            jTextFieldDateSolve.setText(datesolve);
            jTextFieldNamefront.setText(namefront);
            jTextFieldNameBack.setText(nameback);
            jTextAreaContent.setText(content);
            jTextFieldTitle.setText(title);
            jTextFieldNameCustomer.setText(namecustom);
            jTextAreaSolution.setText(solution);
            jComboBoxStatus.setSelectedItem(namestatus);
        } catch (Exception ex) {
        }
    }//GEN-LAST:event_jTableReportKeyReleased

    private void jComboBoxYearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxYearActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jComboBoxYearActionPerformed

    private void jRadioButtonDateFinishActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonDateFinishActionPerformed
        // TODO add your handling code here:
        if (jRadioButtonDateFinish.isSelected() == true) {
            jRadioButtonDispatch.setEnabled(false);
            jTextFieldSearch.setEnabled(false);
        }
        if (jRadioButtonDateFinish.isSelected() == false) {
            jRadioButtonDispatch.setEnabled(true);
            jTextFieldSearch.setEnabled(true);
        }

    }//GEN-LAST:event_jRadioButtonDateFinishActionPerformed

    private void jButtonResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonResetActionPerformed
        // TODO add your handling code here:
        idreport = -1;
        if (iddepartment == 1) {
            Display(BugReport.ListIDRP());
            jTextAreaSolution.setText("");
            jTextAreaContent.setText("");
            jTextFieldTitle.setText("");
            jTextFieldNamefront.setText("");
            jTextFieldNameCustomer.setText("");
            jTextFieldNameBack.setText("");
            jTextFieldDateReceive.setText("");
            jTextFieldDateFinish.setText("");
            jTextFieldDateSolve.setText("");

        } else if (iddepartment == 2) {
            Display(BugReport.ListReportonType(1));
            jTextAreaSolution.setText("");
           jTextAreaContent.setText("");
            jTextFieldTitle.setText("");
            jTextFieldNamefront.setText("");
            jTextFieldNameCustomer.setText("");
            jTextFieldNameBack.setText("");
            jTextFieldDateReceive.setText("");
            jTextFieldDateFinish.setText("");
            jTextFieldDateSolve.setText("");
        } else if (iddepartment == 3) {
            Display(BugReport.ListReportonType(2));
            jTextAreaSolution.setText("");
            jTextAreaContent.setText("");
            jTextFieldTitle.setText("");
            jTextFieldNamefront.setText("");
            jTextFieldNameCustomer.setText("");
            jTextFieldNameBack.setText("");
            jTextFieldDateReceive.setText("");
            jTextFieldDateFinish.setText("");
            jTextFieldDateSolve.setText("");
        }

    }//GEN-LAST:event_jButtonResetActionPerformed

    private java.sql.Date convertdate() {
        Date now = new Date();
        java.sql.Date finish11 = new java.sql.Date(now.getTime());
        try {
            String finish = this.jComboBoxYear.getSelectedItem().toString() + "-" + this.jComboBoxMonth.getSelectedItem().toString() + "-" + this.jComboBoxDay.getSelectedItem().toString();
            SimpleDateFormat spf = new SimpleDateFormat("yyyy-MM-dd");
            spf.setLenient(false);
            Date finish1 = spf.parse(finish);
            finish11 = new java.sql.Date(finish1.getTime());
        } catch (Exception ex) {
            return finish11;
        }
        return finish11;
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButtonAdd;
    private javax.swing.JButton jButtonDelete;
    private javax.swing.JButton jButtonReset;
    private javax.swing.JButton jButtonSearchYear;
    private javax.swing.JButton jButtonUpdate;
    private javax.swing.JComboBox jComboBoxDay;
    private javax.swing.JComboBox jComboBoxMonth;
    private javax.swing.JComboBox jComboBoxStatus;
    private javax.swing.JComboBox jComboBoxYear;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelTiTle;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel26;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel28;
    private javax.swing.JPanel jPanel29;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel30;
    private javax.swing.JPanel jPanel31;
    private javax.swing.JPanel jPanel32;
    private javax.swing.JPanel jPanel33;
    private javax.swing.JPanel jPanel34;
    private javax.swing.JPanel jPanel35;
    private javax.swing.JPanel jPanel36;
    private javax.swing.JPanel jPanel37;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JRadioButton jRadioButtonBoth;
    private javax.swing.JRadioButton jRadioButtonDateFinish;
    private javax.swing.JRadioButton jRadioButtonDispatch;
    private javax.swing.JRadioButton jRadioButtonNotSolve;
    private javax.swing.JRadioButton jRadioButtonSolve;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTable jTableReport;
    private javax.swing.JTextArea jTextAreaContent;
    private javax.swing.JTextArea jTextAreaSolution;
    private javax.swing.JTextField jTextFieldDateFinish;
    private javax.swing.JTextField jTextFieldDateReceive;
    private javax.swing.JTextField jTextFieldDateSolve;
    private javax.swing.JTextField jTextFieldNameBack;
    private javax.swing.JTextField jTextFieldNameCustomer;
    private javax.swing.JTextField jTextFieldNamefront;
    private javax.swing.JTextField jTextFieldSearch;
    private javax.swing.JTextField jTextFieldTitle;
    // End of variables declaration//GEN-END:variables
}
